//package com.jcoinexchange.market.controller;
//
//import com.jcoinexchange.web.entity.BasicResponse;
//import com.jcoinexchange.web.entity.BasicResponse;
//
//import com.jcoinexchange.market.common.vo.ConnectionInfoRes;
//import com.jcoinexchange.market.business.UserLoginService;
//import com.jcoinexchange.market.business.WsRouteService;
//import com.jcoinexchange.web.entity.BasicResponse;
//import io.swagger.annotations.Api;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import jakarta.servlet.http.HttpServletRequest;
//import java.util.UUID;
//
//@Tag(name = "授权ws连接信息")
//@RestController
//@RequestMapping("connection")
//public class ConnectionController {
//
//    @Autowired
//    private UserLoginService userLoginService;
//
//    @Autowired
//    private WsRouteService wsRouteService;
//
//    @PostMapping("/login")
//    public BasicResponse<ConnectionInfoRes> login(HttpServletRequest request) {
//
//        String token = request.getHeader("x-token");
//
//        String memberId = "";
//        if (!StringUtils.isBlank(token)) {
//            Long login = userLoginService.Login(token);
//            memberId = login != null && login > 0 ? login.toString() : "";
//        }
//
//        // 如果为空，则游客登录
//        if (StringUtils.isBlank(memberId)) {
//            memberId = UUID.randomUUID().toString();
//        }
//
//        ConnectionInfoRes connectionInfoRes = wsRouteService.connectionLogin(memberId);
//
//        return BasicResponse.success(connectionInfoRes);
//    }
//
//}
